package com.hnas.ecard.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.hnas.core.dto.DTOPagedList;
import com.hnas.ecard.dao.CommoditMrchDao;
import com.hnas.ecard.mapper.CommoditMrchMapper;
import com.hnas.ecard.orm.CommoditMrch;
import com.hnas.ecard.service.CommoditMrchService;
import com.hnas.ecard.service.dto.DTOCommodit;
import com.hnas.ecard.service.dto.DTOCommoditMrch;
import com.hnas.ecard.service.dto.DTOCommoditMrchSearch;
import com.hnas.ecard.service.search.DTOCommoditSearch;

@Component("commoditMrchService")
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
public class CommoditMrchServiceImpl implements CommoditMrchService{

	@Autowired
	private CommoditMrchDao commoditMrchDao;
	
	@Override
	public CommoditMrch saveOrUpdate(DTOCommoditMrch dto) throws Exception {
		return commoditMrchDao.saveOrUpdate(dto);
	}

	@Override
	public List<CommoditMrch> listCommoditMrch() {
		return commoditMrchDao.listCommoditMrch();
	}

	@Override
	public String findMrch(String orderNo) {
		return commoditMrchDao.findMrch(orderNo);
	}

	@Override
	public DTOPagedList<DTOCommoditMrch> page(DTOCommoditMrchSearch criteria) {
		return commoditMrchDao.page(criteria);
	}

	@Override
	public DTOCommoditMrch findById(String id) {
		CommoditMrch find = commoditMrchDao.find(id);
		return CommoditMrchMapper.getInstance().mapToValue(find);
	}

	@Override
	public boolean deleteById(String id) {
		return commoditMrchDao.deleteById(id);
	}

	@Override
	public DTOPagedList<DTOCommodit> pageCommodit(DTOCommoditSearch criteria) {
		return commoditMrchDao.pageCommodit(criteria);
	}

}
